
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/*
 *  参考：  java.lang
 *
    public interface Comparable<T>
         int compareTo(T o);
    }

 */

class Student implements Comparable<Student>{
    String id;
    String name;
    int score;

    public Student(String id, String name, int score) {
        this.id = id;
        this.name = name;
        this.score = score;
    }

    public int compareTo(Student o){
        if(this.score==o.score){
            return this.id.compareTo(o.id);
        }
        return -(this.score-o.score);
    }

    public String toString(){
        return "["+id+","+name+","+score+"]";
    }
}

public class Main1{
    public static void main(String[] args) {
        List<Student> stuList = new ArrayList<Student>();
        Scanner sc = new Scanner(System.in);
        for(int i=0;i<5;i++) {
            String id = sc.next();
            String name = sc.next();
            int score = sc.nextInt();
            stuList.add(new Student(id,name,score));
        }
        Collections.sort(stuList);
        System.out.println(stuList);
        sc.close();
    }
}
